<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="utf-8" />
        <title>jquery selector</title>
        <link rel="stylesheet" href="css/style.css" />
    </head>
    <body>
        <div id="layout">
            <ul>
                <li v='a'>item a</li>
                <li v='b'>item b1</li>
                <li v='b'>item b2</li>
            </ul>
        </div>
        <button onclick="showtxt('a');">提交a</button>
        <button onclick="showtxt('b');">提交a</button>
        <script src="js/jquery.min.js"></script>
        <script type="text/javascript">
            function showtxt(v){
                //$("ul>li[v='"+v+"']").each(function(){
                   // console.log($(this).text());
                //});
                //只获取第一个
                var ve = $("ul>li[v='"+v+"']");
                if (ve.length>=0){
                    console.log($(ve[0]).text());
                }
            }
        </script>
    </body>
</html>
